﻿Imports System
Imports System.IO
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
''' <summary>
''' 计算结果按时间分类
''' </summary>
''' <remarks></remarks>
<Serializable()> Public Class ResultAerageingTime

    Private m_NameAndData(-1) As NameAndData '用于储存计算结果。按最高值从高到低
    Private m_MaxTalbeResult As New MaxTalbeResult '用于储存前n最大值的计算结果
    ''' <summary>
    ''' 用于储存不同平均时间的不同最大值的结果文件的名称和内容字符串
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property NameAndData() As NameAndData()
        Get
            Return Me.m_NameAndData
        End Get
        Set(ByVal value As NameAndData())
            Me.m_NameAndData = value
        End Set
    End Property

   
    ''' <summary>
    ''' 用于储存前n最大值的计算结果
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property MaxTalbeResult() As MaxTalbeResult
        Get
            Return m_MaxTalbeResult
        End Get
        Set(ByVal value As MaxTalbeResult)
            m_MaxTalbeResult = value
        End Set
    End Property

    ''' <summary>
    ''' 从AERMOD.OUT文件中获取相应的数据
    ''' </summary>
    ''' <param name="strAERMODOUT">输出文件内容的数组</param>
    ''' <param name="Receptor">接受点</param>
    ''' <param name="IsDep">沉降</param>
    ''' <param name="strAerageTime">平均时间</param>
    ''' <param name="strGroup">组</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetDataFromAERMODOUT(ByVal strAERMODOUT As String(), ByVal Receptor As Receptor, ByVal IsDep As Boolean, ByVal strAerageTime As String, ByVal OutPutOption As OutPuts, ByVal strGroup As String, ByVal IsAnalisis As Boolean, ByVal GroupSourceCount As Integer, ByVal version As String) As Boolean
        ReDim Me.m_NameAndData(OutPutOption.Rectable.MaxCon)
        For i As Integer = 0 To OutPutOption.Rectable.MaxCon '前nMax大的结果储存
            Me.m_NameAndData(i) = New NameAndData
            Select Case i
                Case 0
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "1ST", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 1
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "2ND", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 2
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "3RD", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 3
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "4TH", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 4
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "5TH", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 5
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "6TH", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 6
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "7TH", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 7
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "8TH", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 8
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "9TH", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
                Case 9
                    If m_NameAndData(i).GetDataFromAERMODOUT(strAERMODOUT, Receptor, IsDep, strAerageTime, "10TH", strGroup, IsAnalisis, GroupSourceCount, version) = False Then
                        Return False
                    End If
            End Select
            ''--------------------------------------------------------------------

        Next
        Return True
    End Function


    
    ''' <summary>
    ''' 根据项目的内容，设置结果数组中的文件名及内容
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub SetNameAndDate()
        ReDim Me.m_NameAndData(m_NameAndData.Length - 1) '设置数组的大小
        'ReDim Me.m_MaxValue(m_NameAndData.Length - 1)
        'ReDim Me.m_MinValue(m_NameAndData.Length - 1)
        'For i As Integer = 0 To m_NameAndData.Length - 1
        '    Me.m_NameAndData(i) = New NameAndData
        '    Me.m_NameAndData(i).Name = m_NameAndData(i).Name  '设置第一列为文件名
        '    'Me.m_MaxValue(i) = 0
        '    'Me.m_MinValue(i) = 1000000000
        '    Try
        '        Me.m_NameAndData(i).Data = My.Computer.FileSystem.ReadAllText(FileName, System.Text.Encoding.GetEncoding("GB2312"))
        '    Catch ex As Exception
        '        MsgBox("结果分析文件错误，请与作者联系")
        '    End Try
        'Next
    End Sub
End Class
